package com.ch.home.testService;

import com.ch.home.bean.Source;
import com.ch.home.service.serviceImpl.sourceServiceImpl.SourceServiceImpl;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * Created by CHEN on 2019/8/26.
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class testSourceServiceImpl {

    @Autowired
    SourceServiceImpl sourceService;


//
//    HashMap addSource(Source source);
//
//    HashMap updateSource(Source source);
//
//    HashMap getPreviewSourceByCondition(Source source);
//
//    HashMap getSourceByCondition(Source source);
//
//    HashMap getAllSourceByCondition(Source source);


    @Test
    public void testAddSource(){
        System.out.println(sourceService.addSource(new Source(null,1,"http://www.aliyouth.cn/repository/Image/CodeResource.png","http://www.aliyouth.cn/repository/Image/CodeResource.png",5)) );

    }

    @Test
    public void testUpdateSource(){
        System.out.println(sourceService.updateSource(new Source(13,null,"http://www.baidu.com","http://www.baidu.com",null)) );

    }


    @Test
    public void testGetSourceByCondition(){

        System.out.println("-------------------------------------------------" );
        System.out.println("-------------------------------------------------" );

        System.out.println(sourceService.getPreviewSourceByCondition(new Source(11,null,null,null,null)) );
        System.out.println(sourceService.getSourceByCondition(new Source(11,null,null,null,null)) );
        System.out.println(sourceService.getAllSourceByCondition(new Source(11,null,null,null,null)) );

        System.out.println("-------------------------------------------------" );
        System.out.println("-------------------------------------------------" );


        System.out.println("-------------------------------------------------" );
        System.out.println("-------------------------------------------------" );

        System.out.println(sourceService.getPreviewSourceByCondition(new Source(null,1,null,null,1)) );
        System.out.println(sourceService.getSourceByCondition(new Source(null,1,null,null,1)) );
        System.out.println(sourceService.getAllSourceByCondition(new Source(null,1,null,null,1)) );

        System.out.println("-------------------------------------------------" );
        System.out.println("-------------------------------------------------" );


        System.out.println("-------------------------------------------------" );
        System.out.println("-------------------------------------------------" );

    }



}
